package mysql

import "gorm.io/gorm"

type Product struct {
	gorm.Model
	Name  string  `gorm:"type:varchar(30)"`
	Price float64 `gorm:"type:decimal(10,2)"`
	Stock int     `gorm:"type:int(30)"`
}

func (p *Product) ProductAdd() error {
	return DB.Create(&p).Error
}

func (p *Product) ProductFind(productId int) error {
	return DB.Where("id = ?", productId).First(&p).Error
}
